<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h2>添加投诉页面</h2>
<form method="post" action="/veh/add" th:action="@{/veh/add}">
    <table>
        <tr>
            <td>投诉品牌：</td>
            <td><select name="brandId" id="brandId" class="form-control">
                <option value="0">--请选择--</option>
            </select>
        </tr>
        <tr>
            <td>投诉问题：</td>
            <td><input type="text" name="problem"></td>
        </tr>
        <tr>
            <td>投诉车系：</td>
            <td><input type="text" name="carType"></td>
        </tr>
        <tr>
            <td>投诉时间：</td>
            <td><input type="date" name="complaintsTime"> yyyy-MM-dd</td>
        </tr>
        <tr>
            <td>投诉状态：</td>
            <td><input type="radio" value="0" name="status" checked>信息审核&nbsp;&nbsp;<input type="radio" value="1" name="status" >厂家受理</td>
        </tr>
        <tr>
            <td>相关操作:</td>
            <Td><input type="submit" value="新增"> <input type="button"  value="返回" onclick="fan()"></Td>
        </tr>

    </table>
</form>

</body>
<script th:src="@{https://code.jquery.com/jquery-3.5.1.min.js}" src="js/jquery.js"></script>
<script>

    $(document).ready(function(){
        $.ajax({
            type:"GET",
            url:"/selectAll",
            dataType:"json",
            success:function(data){
                //获取model中roleId
                // var brandId=[[${brandId}]];
                // alert("json："+data);
                for(var i in data){
                    var op="<option ";
                    // if(data[i].brandId==brandId){
                    //     op+=" selected='selected' ";
                    // }
                    op+= " value='"+data[i].brandId+"'>"+data[i].brandName+"</option>";
                    $("#brandId").append(op);
                }
            },
            error:function(data){
                alert("对不起，获取数据失败！");
            }
        });
    });
    function fan(){
        history.go(-1);
    }

</script>
</html>